import type { InternalAxiosRequestConfig, AxiosResponse, AxiosError, AxiosRequestConfig } from "axios"

export interface CostomInterceptors<T = AxiosResponse> {
  //请求拦截
  requestSuccessFn?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig,
  requestFailureFn?: (err: AxiosError) => AxiosError,
  //响应拦截
  responseSuccessFn?: (res: T) => T,
  responseFailureFn?: (err: AxiosError) => AxiosError
}

export interface CostomRequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
  interceptors?: CostomInterceptors<T>
}

export interface CostomInternalRequestConfig<T = AxiosResponse> extends InternalAxiosRequestConfig {
  interceptors?: CostomInterceptors<T>
}
export interface cancelToken {
  cancel: any,
  url: string
}

export interface resType {
  code?: number,
  data?: any,
  count?: number,
  msg: string | null,
  // av sdk的 返回参数
  ret?: number,
  [key: string]: any
}

export interface requestOption {
  isResolve?: boolean, //是否返回数据到调用接口位置
  ignoreCancelToken?: boolean, // 此接口是否不能不取消 即当前接口加入取消请求白名单
  fileType?: string,
  fileName?: string,
}